/*
 * To change this template, choose Tools | Templates
 * and open the template in the editor.
 */
package Serializacion;

import java.io.FileInputStream;
import java.io.FileNotFoundException;
import java.io.IOException;
import java.io.ObjectInputStream;

/**
 *
 * @author Christian
 */
public class Deserializacion {
    public static void main(String[] args) {
        Agenda a1 = null;
        Agenda a2 = null;
        try {
            // recuperar un asrchivo de disco
            FileInputStream fis = new FileInputStream("agenda1.ser");
            // stream para recuperar o reconstruir oBjetos
            ObjectInputStream ois = new ObjectInputStream(fis);
            // el metodo readObject() recupera el objeto
            a1 = (Agenda)ois.readObject();
            a2 = (Agenda)ois.readObject();
            ois.close();
        }catch (FileNotFoundException e){
            e.printStackTrace();
        } catch (IOException e) {
            e.printStackTrace();
        } catch (ClassNotFoundException e ) {
            e.printStackTrace();
        }
        System.out.println(a1);
        System.out.println(a2);        
    }
}
